# -*- coding:utf-8 -*-

__author__='zhaoxp'

'''
用关键字参数来表达可选行为
'''

def remainder(number,divisor):
    return number%divisor

def flow_rate(weigtht_diff,time_diff):
    return weight_diff / time_diff

def flow_rate(weigtht_diff,time_diff,period):
    return ( weight_diff / time_diff )*period

def flow_rate(weigtht_diff,time_diff,period=1):
    return ( weight_diff / time_diff )*period

def flow_rate(weigtht_diff,time_diff,period=1,units_per_kg=1):
    return ( (weight_diff * units_per_kg) / time_diff )*period

if __name__=='__main__':
    print('use keyword args')
    print("""
def remainder(number,divisor):
    return number%divisor
    """)
    print("remainder(20,7) = %s"%remainder(20,7))
    print("remainder(20,divisor=7) is %s"%remainder(20,divisor=7))
    print("remainder(number=20,divisor=7) is %s"%remainder(number=20,divisor=7))
    #print(remainder(number=20,7)) # compile error
    

